import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Chat {

    private static boolean isClose = false;
    public static void main(String[] args) throws IOException {
        try {
            ServerSocket server = new ServerSocket(1234);
            NetWork network = new NetWork();

            while (!isClose) {

                Socket socket = server.accept();

                System.out.println("Client connected!");

                Thread thread = new Thread(new Client(socket, network));
                thread.start();
            }
            server.close();
        } catch (IOException e) {
            System.out.println("close");
        }
    }
}
